package com.example.xln111.Dao;

import com.example.xln111.model.Grade;
import com.example.xln111.model.Student;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface GradeMapper {
        @Select("SELECT * FROM grade")
        public List<Grade> getAll();

        @Insert("INSERT INTO grade(studentId,courseId,time,score) VALUES(#{studentId},#{courseId}, #{time}, #{score})")
        public int addGrade(Grade grade);

        @Update("UPDATE grade SET courseId = #{courseId},time = #{time},score = #{score} WHERE studentId = #{studentId}")
        public int updateGrade(Grade grade);

        @Delete("DELETE FROM grade WHERE studentId = #{studentId}")
        public int deleteGradeById(int studentId);

        @Select("SELECT * FROM grade WHERE studentId = #{studentId}")
        public Grade getGradeById(int studentId);
    }

